<%@ page contentType="text/html;charset=UTF-8" language="java"  import="java.util.*" trimDirectiveWhitespaces="true" %>
<%@include file="common/taglib.jsp"%>
    
<head>
        <title>管理后台登录页 </title>
    <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
       <%@include file="common/commonCss.jsp"%>
    <link rel="stylesheet" href="${basePath}/resources/css/matrix-login.css" />

    </head>

<style>
     *{
         font-family:"微软雅黑";
     }
    .form-actions {  margin-bottom: 0; background:none; text-align:center}
    .btn {
        display: inline-block;
        padding: 4px 12px;
        margin-bottom: 0;
        font-size: 14px;
        line-height: 20px;
        color: #333;
        text-align: center;
        text-shadow: 0 1px 1px rgba(255,255,255,0.75);
        vertical-align: middle;
        cursor: pointer;
        background-color: #f5f5f5;
        background-image: -moz-linear-gradient(top, #fff, #e6e6e6);
        background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#e6e6e6));
        background-image: -webkit-linear-gradient(top, #fff, #e6e6e6);
        background-image: -o-linear-gradient(top, #fff, #e6e6e6);
        background-image: linear-gradient(to bottom, #fff, #e6e6e6);
        background-repeat: repeat-x;
        border: 1px solid #ccc;
        border-color: #e6e6e6 #e6e6e6 #bfbfbf;
        border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
        border-bottom-color: #b3b3b3;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
        filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
        -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.05);
        -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.05);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.05);
    }

    .btn-success {
        color: #fff;
        padding:6px 40%;
        text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
        background-color: #5bb75b;
        background-image: -moz-linear-gradient(top, #62c462, #51a351);
        background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));
        background-image: -webkit-linear-gradient(top, #62c462, #51a351);
        background-image: -o-linear-gradient(top, #62c462, #51a351);
        background-image: linear-gradient(to bottom, #62c462, #51a351);
        background-repeat: repeat-x;
        border-color: #51a351 #51a351 #387038;
        border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0);
        filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
    }
</style>
    <body>
        <div id="loginbox">            
            <form id="loginform" class="form-vertical" action="">
				 <div class="control-group normal_text"> <h3>后台管理系统</h3></div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_lg"><i class="icon-user"></i></span><input type="text"  id="account" autocomplete="off" autofocus="autofocus" maxlength="60" placeholder="请输入账号..." />
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_ly"><i class="icon-lock"></i></span><input type="password" id="password" autocomplete="off" placeholder="请输入密码..." />
                        </div>
                    </div>
                </div>
                <div class="form-actions">
                    <span><a  href="javascript:void(0);" onclick="tz_login(this)" class="btn btn-success">登陆</a></span>
                </div>
                <%--<div class="form-actions">--%>
                    <%--&lt;%&ndash;<span class="pull-left"><a href="#" class="flip-link btn btn-info" id="to-recover">忘记密码</a></span>&ndash;%&gt;--%>
                    <%--&lt;%&ndash;<span class="pull-right"><a type="submit" onclick="tz_login(this)"  class="btn btn-success" > 登录</a></span>&ndash;%&gt;--%>
                <%--</div>--%>
            </form>
            <form id="recoverform" action="#" class="form-vertical">
				<p class="normal_text">请输入您的电子邮件地址，然后我们将向您发送如何恢复密码的说明。</p>

                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_lo"><i class="icon-envelope"></i></span><input type="text" placeholder="E-mail address" />
                        </div>
                    </div>

                <div class="form-actions">
                    <span class="pull-left"><a href="#" class="flip-link btn btn-success" id="to-login">&laquo; Back to login</a></span>
                    <span class="pull-right"><a class="btn btn-info">Reecover</a></span>
                </div>
            </form>
        </div>

        <input type="hidden" id="returnUrl"  value="${returnUrl}">
        <%@include file="common/commonJS.jsp"%>
        <script type="text/javascript" src="${basePath}/resources/js/matrix.login.js"></script>


        <script>
            $(function(){
                $(document).keydown(function(e){
                    if(e.keyCode==13){
                        tz_login();
                    }
                });

                $("#account").keyup(function(){
                    tzMap.put("keke_admin_account",$(this).val(),1);
                });

                var username = tzMap.get("keke_admin_account",1);
                if(username)$("#account").val(username);

            });


            function tz_login(obj){
                var account = $("#account").val();
                var password = $("#password").val();
                var params = {account:account,password:password};
                if(isEmpty(account)){
                    loading("请输入账号",4);
                    $("#account").focus();
                    return;
                }
                if(isEmpty(password)){
                    loading("请输入密码",4);
                    $("#password").focus();
                    return;
                }

                $(obj).removeAttr("onclick").text("登陆中....");
                tzAjax.request({
                    url:basePath+"/logined",
                    error:function(){$(obj).attr("onclick","tz_login(this)").text("登陆中");},
                    success:function(data){
                        $(obj).attr("onclick","tz_login(this)").text("登陆中");
                        if(data=="error" || data=="null"){
                            loading("请填写账号或者密码..." , 3);
                            $("#password").val("");
                            $("#account").select();
                        }else if(data=="fail"){
                            //账号或者密码输入错误
                            $("#password").val("");
                            $("#account").select();
                            loading("请输入正确的账号和密码!!!" ,3);
                        }else if(data=="forbiden"){
                            $("#password").val("");
                            $("#account").select();
                            loading("您的账号已被禁止...",3);
                        }else{
                            var returnUrl = $("#returnUrl").val();
                            if(returnUrl){
                                window.location.href = returnUrl;
                            }else{
                                //登陆成功
                                var refer = document.referrer;
                                //登陆成功
                                window.location.href = isNotEmpty(refer) ? refer: adminPath+"/index";
                            }

                        }
                    }
                },params);
//                $.ajax({
//                    type:"post",
//                    url:basePath+"/logined",
//                    data:params,
//                    success:function(data){
//                        if(data=="error" || data=="null"){
//                            loading("请填写账号或者密码..." , 3);
//                            $("#password").val("");
//                            $("#account").select();
//                        }else if(data=="fail"){
//                            //账号或者密码输入错误
//                            $("#password").val("");
//                            $("#account").select();
//                            loading("请输入正确的账号和密码!!!" ,3);
//                        }else if(data=="forbiden"){
//                            $("#password").val("");
//                            $("#account").select();
//                            loading("您的账号已被禁止...",3);
//                        }else{
//                            //登陆成功
//                            window.location.href = adminPath+"/index";
//                        }
//                    }
//                });
            };
        </script>
    </body>

</html>
